package com.biz.primus.ms.promotion.dao.repository;

import com.biz.primus.base.enums.CommonStatus;
import com.biz.primus.ms.base.jpa.repository.CommonJpaRepository;
import com.biz.primus.ms.promotion.dao.po.BasePromotion;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.data.repository.NoRepositoryBean;

/**
 * 促销Base JPA Repository
 *
 * @author david-liu
 */
@NoRepositoryBean
public interface PromotionBaseRepository<T extends BasePromotion, ID extends Serializable> extends CommonJpaRepository<T, ID> {

    /**
     * 查询当前生效的折扣促销
     *
     * @param startTime 促销开始时间
     * @param endTime 促销结束时间安
     * @param commonStatus 促销启用状态
     * @return 折扣促销集合
     */
    List<T> findByStartTimeBeforeAndEndTimeAfterAndCommonStatusOrderByStartTime(LocalDateTime startTime, LocalDateTime endTime, CommonStatus commonStatus);
}
